package com.wallet.my.service;

import com.wallet.my.controller.model.BindBankRequest;
import com.wallet.my.controller.model.NewHDWalletRequest;
import com.wallet.my.dao.pojo.AccountDO;
import com.wallet.my.dao.pojo.TransRecordDO;
import org.bitcoinj.wallet.UnreadableWalletException;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.web3j.protocol.core.methods.response.EthGetTransactionReceipt;
import org.web3j.protocol.core.methods.response.EthTransaction;

import javax.servlet.http.HttpSession;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;

/**
 * 以太坊的功能接口
 **/
public interface EthService {

//获取网络连接点信息，来判断是否连接成功
    public String getClientVersion();

//创建一个钱包，先生成助记词mnemonicWords-再种子seed-   助记词指定路径////prieth  --椭圆加密eck---拿到私钥，公钥，地址
    public Map<String,Object> newWallet(String password, HttpSession session);

//    用助记词创建一个账户
    public Map<String,Object> newAccount(String mnemonic,HttpSession session);

//    根据地址删除一个账户
    public Map<String,Object> deleteAccountByAddress(String address,HttpSession session);

//    查询已管理的所有账号信息
    public List<AccountDO> getAllAccountByName(String username);

//    根据地址查询余额
    public Map<String,Object> getBalance(String address);

//转账
    public Map<String, Object> transferETH(String fromAddr, String privateKey, String toAddr, BigDecimal money, BigInteger gasLimit, String data);

//    根据transHash查询交易详情
    public EthTransaction getTransInfoByHash(String transHash);

//    根据transHash查询交易凭证
    public EthGetTransactionReceipt getTransReceipt(String transHash);

//    获取当前库里所有地址
    public List<String> getAllAddress();

//    获取用户名下所有地址，用于更新账户余额等信息
    public List<String> getAllAddressByName(String username);

//    根据库里地址查询交易记录
    public List<TransRecordDO> getTransRecordByAddress(String address);

//    创建bip44的HD钱包
    public Map<String,Object> newHDWallet(NewHDWalletRequest newHDWalletRequest,HttpSession session);

//    创建bip44HD钱包的子账户，需要助记词和地址，地址由后台自动累加，存入库
    public Map<String,Object> newHDAccount(NewHDWalletRequest newHDWalletRequest,HttpSession session);

//    根据address绑定一张银行卡
    public Map<String,Object> bindBankByAddress(BindBankRequest bindBankRequest);

//    根据address解绑一张银行卡
    public Map<String,Object> unbindBankByAddress(BindBankRequest bindBankRequest);

}
